package xing.design.pattern.structure.Decorator;

/**
 * 虽然产生了链式，但内部并不是 super.xxx，二者是聚合关系。
 *
 * @author xing
 * @date 2023/2/7 22:50:25
 */
public class Main {
    public static void main(String[] args) {
        // 新建基类
        Basic basic = new Basic();
        // 添加第一层装饰
        Decorator1 decorator1 = new Decorator1(basic);
        // 添加第二层装饰
        Decorator2 decorator2 = new Decorator2(decorator1);
        Decorator1 decorator11 = new Decorator1(decorator1);
        // show()
        decorator11.show();
        System.out.println("---");
        decorator2.show();
    }
}
